﻿using CleanArchitecture.Core.Interfaces;
using CleanArchitecture.Infrastructure.Entities.Business;
using CleanArchitecture.Infrastructure.Entities.Common;
using System;
using System.Collections.Generic;

namespace CleanArchitecture.Infrastructure.Interfaces.Business
{
    public partial interface IBlogService 
    {
        #region Blog

        /// <summary>
        /// Deletes a Blog Batch
        /// </summary>
        /// <param name="newsItems">News item List</param>
        /// <param name="logEvent">Whether to log Delete Event</param>
        void DeleteBlogsBatch(IList<BlogItem> blogItems, bool logEvent = true);
        
        /// <summary>
        /// 当导航菜单为单页内容导航时，查询该导航菜单所对应的博客文章
        /// </summary>
        /// <param name="columnid"></param>
        /// <returns></returns>
        BlogItem GetBlogItemForSinglePageColumn(int columnid);
        /// <summary>
        /// Gets a Blog
        /// </summary>
        /// <param name="blogId">The blog identifier</param>
        /// <returns>News</returns>
        BlogItem GetBlogItemById(int blogId);

        /// <summary>
        /// Gets news
        /// </summary>
        /// <param name="blogIds">The blog identifiers</param>
        /// <returns>News</returns>
        IList<BlogItem> GetBlogItemListByIds(int[] blogIds);

        /// <summary>
        /// Gets all blogs
        /// </summary>
        /// <param name="pageIndex">Page index</param>
        /// <param name="pageSize">Page size</param>
        /// <returns>News items</returns>
        IViewPagedList<BlogItem> GetBlogItemsByPage(int columnId = 0, int[] roleIds = null, int pageIndex = 0, int pageSize = int.MaxValue);
        /// <summary>
        /// 按指定语言及博客浏览量排序统计查询最热门的前 {top} 篇博文
        /// 为提高查询效率使用MemoryCache缓存，因为对实时统计要求不高，只需要缓存期过期后更新查询
        /// </summary>
        /// <param name="langid">指定语言LanguageId</param>
        /// <param name="top">获取博文数量</param>
        /// <returns></returns>
        IList<HotArticleQuery> GetHotBlogItems(int langid, int top = 10);
        /// <summary>
        /// 统计博客总数
        /// </summary>
        /// <returns></returns>
        int StatisticsBlogsCount();
        /// <summary>
        /// Inserts a blog item
        /// </summary>
        /// <param name="blog">BlogItem</param>
        void InsertBlog(BlogItem blog);

        /// <summary>
        /// Updates the blog item
        /// </summary>
        /// <param name="news">BlogItem</param>
        void UpdateBlog(BlogItem blog);

        /// <summary>
        /// Get a value indicating whether a BlogItem is available now (availability dates)
        /// </summary>
        /// <param name="blogItem">blog item</param>
        /// <param name="dateTime">Datetime to check; pass null to use current date</param>
        /// <returns>Result</returns>
        bool IsBlogAvailable(BlogItem blogItem, DateTime? dateTime = null);

        #endregion

        #region Blog comments

        ///// <summary>
        ///// Gets all comments
        ///// </summary>
        ///// <param name="customerId">Customer identifier; 0 to load all records</param>
        ///// <param name="storeId">Store identifier; pass 0 to load all records</param>
        ///// <param name="newsItemId">News item ID; 0 or null to load all records</param>
        ///// <param name="approved">A value indicating whether to content is approved; null to load all records</param> 
        ///// <param name="fromUtc">Item creation from; null to load all records</param>
        ///// <param name="toUtc">Item creation to; null to load all records</param>
        ///// <param name="commentText">Search comment text; null to load all records</param>
        ///// <returns>Comments</returns>
        //IList<NewsComment> GetAllComments(int customerId = 0, int storeId = 0, int? newsItemId = null,
        //    bool? approved = null, DateTime? fromUtc = null, DateTime? toUtc = null, string commentText = null);

        ///// <summary>
        ///// Gets a news comment
        ///// </summary>
        ///// <param name="newsCommentId">News comment identifier</param>
        ///// <returns>News comment</returns>
        //NewsComment GetNewsCommentById(int newsCommentId);

        ///// <summary>
        ///// Get news comments by identifiers
        ///// </summary>
        ///// <param name="commentIds">News comment identifiers</param>
        ///// <returns>News comments</returns>
        //IList<NewsComment> GetNewsCommentsByIds(int[] commentIds);

        ///// <summary>
        ///// Get the count of news comments
        ///// </summary>
        ///// <param name="newsItem">News item</param>
        ///// <param name="storeId">Store identifier; pass 0 to load all records</param>
        ///// <param name="isApproved">A value indicating whether to count only approved or not approved comments; pass null to get number of all comments</param>
        ///// <returns>Number of news comments</returns>
        //int GetNewsCommentsCount(NewsItem newsItem, int storeId = 0, bool? isApproved = null);

        ///// <summary>
        ///// Deletes a news comment
        ///// </summary>
        ///// <param name="newsComment">News comment</param>
        //void DeleteNewsComment(NewsComment newsComment);

        ///// <summary>
        ///// Deletes a news comments
        ///// </summary>
        ///// <param name="newsComments">News comments</param>
        //void DeleteNewsComments(IList<NewsComment> newsComments);

        #endregion
    }
}
